export default {
    mode: 'universal',
    server: {
        port: 3000, // default: 3000
        host: '0.0.0.0' // default: localhost
    },
    // other configs

    /*
     ** Headers of the page
     */
    head: {
        title: '掌上大学-企业的校园事业部',
        meta: [
            { charset: 'utf-8' },
            { name: 'renderer', content: 'webkit' },
            {
                name: 'viewport',
                content:
                    'width=device-width,target-densitydpi=high-dpi,initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui'
            },
            {
                name: 'format-detection',
                content: 'telephone=no'
            },
            {
                name: 'format-detection',
                content: 'email=no'
            },
            {
                hid: 'keywords',
                name: 'keywords',
                content:
                    '校园推广，校园营销，校园广告，校园传媒，校园渠道公司，校园地推公司，校园推广方案，校园广告投放，校园活动，校园APP推广， APP推广，高校推广，高校营销，高校渠道'
            },
            {
                hid: 'description',
                name: 'description',
                content:
                    '基于2000所高校覆盖率，为企业提供品牌营销、商品分销、长短期人才招聘三项服务'
            }
        ],
        link: [
            {
                rel: 'shortcut icon',
                type: 'image/x-icon',
                href: 'https://cdn.zsdx.cn/zsdx-website/2020/images/fav.png'
            },
            {
                rel: 'stylesheet',
                href: '//at.alicdn.com/t/font_1840236_63e8v7zv6yo.css'
            },
            {
                rel: 'stylesheet',
                href:
                    '//cdn.zsdx.cn/font/din_alternate/din_alternate_bold_embed.css'
            },
            {
                rel: 'apple-touch-icon',
                href: 'https://cdn.zsdx.cn/zsdx-website/2020/images/fav.png'
            }
        ],
        script: [
            { src: '//at.alicdn.com/t/font_1840236_rqmh9ayxrma.js' },
            {
                src:
                    'https://cdn.zsdx.cn/zsdx-website/2020/js/scrolloverflow.min.js'
            }
        ]
    },
    /*
     ** Customize the progress-bar color
     */
    loading: { color: '#fff' },
    /*
     ** Global CSS
     */
    css: ['assets/css/reset.css'],
    /*
     ** Plugins to load before mounting the App
     */
    plugins: [
        // 封装客户端请求,添加登录逻辑
        { src: '@/plugins/post', ssr: true },
        { src: '@/plugins/lazy-load', ssr: true },
        { src: '@/plugins/rem', ssr: false },
        { src: '@/plugins/element-ui', ssr: true },
        { src: '@/plugins/fullpage-ssr', ssr: false }
    ],
    /*
     ** Nuxt.js dev-modules
     */
    buildModules: [
        // Doc: https://github.com/nuxt-community/eslint-module
        '@nuxtjs/eslint-module',
        // Doc: https://github.com/nuxt-community/stylelint-module
        '@nuxtjs/stylelint-module'
    ],
    /*
     ** Nuxt.js modules
     */
    modules: [
        // Doc: https://axios.nuxtjs.org/usage
        '@nuxtjs/axios',
        '@nuxtjs/pwa'
        // 'nuxt-fullpage.js'
    ],
    /*
     ** Axios module configuration
     ** See https://axios.nuxtjs.org/options
     */
    axios: {
        // browserBaseURL: '',
        // 跨域携带cookies
        withCredentials: true
    },
    router: {
        extendRoutes(routes, resolve) {
            routes.push({
                path: '*',
                component: resolve(__dirname, 'pages/index.vue')
            })
        }
    },
    /*
     ** Build configuration
     */
    build: {
        // 开启打包分析
        // analyze: true,
        // assetFilter(assetFilename) {
        //     return assetFilename.endsWith('.js')
        // },
        vendor: ['element-ui'],
        babel: {
            plugins: [
                [
                    'component',
                    {
                        libraryName: 'element-ui',
                        styleLibraryName: 'theme-chalk'
                    }
                ]
            ],
            comments: true
        },
        /*
         ** postcss 兼容处理
         */
        postcss: {
            plugins: {
                // 通过传递 false 来禁用插件
                'postcss-url': false,
                'postcss-nested': {},
                'postcss-responsive-type': {},
                'postcss-hexrgba': {}
            },
            preset: {
                // 更改postcss-preset-env 设置
                autoprefixer: {
                    overrideBrowserslist: [
                        'Android 4.1',
                        'iOS 7.1',
                        'Chrome > 31',
                        'ff > 31',
                        'ie >= 8'
                    ]
                },
                'postcss-pxtorem': {
                    rootValue: 37.5,
                    propList: ['*']
                }
            }
        },
        extend(config, ctx) {
            if (ctx.isDev && ctx.isClient) {
                config.module.rules.push({
                    enforce: 'pre',
                    test: /\.(js|vue)$/,
                    loader: 'eslint-loader',
                    exclude: /(node_modules)/
                })
            }
        },
        // css文件单独打包
        // extractCSS: { allChunks: true },
        extractCSS: true,
        optimization: {
            splitChunks: {
                cacheGroups: {
                    styles: {
                        name: 'styles',
                        test: /\.(css|vue)$/,
                        chunks: 'all',
                        enforce: true
                    }
                }
            }
        }
    }
}
